package Data;

import java.io.Serializable;

/**
 * 文件的信息
 */
public class FileInfo implements Serializable {
    private String filename;
    private String filepath;
    private float fileSize;
    private DataType dataType;

    public FileInfo(String filepath, float fileSize, DataType dataType) {
        this.filename = filepath.substring(filepath.lastIndexOf("/") + 1);
        this.filepath = filepath;
        this.fileSize = (float) fileSize;
        this.dataType = dataType;
    }
    public FileInfo() {
    }

    public float getSize(){
        return fileSize;
    }
    public String getPath(){
        return filepath;
    }
    public String getName(){
        return filename;
    }
    public DataType getDataType(){
        return dataType;
    }

    public void setSize(float fileSize){
        this.fileSize = fileSize;
    }
    public void setPath(String filepath){
        this.filename = filepath.substring(filepath.lastIndexOf("/") + 1);
        this.filepath = filepath;
    }
    public void setName(String filename){
        this.filename = filename;
    }
    public void setDataType(DataType dataType){
        this.dataType = dataType;
    }
    public String toString(){
        return "文件名:"+filename+" 路径:"+filepath+" 大小:"+fileSize+" 类型:"+dataType;
    }

}
